Thread: [qt and C++] Copied some example code but getting an error ~~~ Please help

  1. #1
    Registered User
    Join Date
    Feb 2013
    Posts
    17

    [qt and C++] Copied some example code but getting an error ~~~ Please help

    First of all , I am new in qt and coming from Java
    I want to run and compile some qt code so I can learn it , then I went to this website and saw they provided some qt examples
    Qt 4.6: Analog Clock Example [trinitydesktop.org]
    I use the latest version of the qt and I copied the code but I get some error please help !
    http://s11.postimg.org/7w4rsg3v7/Scrshot1.png
    http://s11.postimg.org/p854dvxcj/Scrshot2.png
    http://s11.postimg.org/9ubfqfwcz/Scrshot3.png
    http://s11.postimg.org/vs7wk8bdf/Scrshot4.png
    http://s11.postimg.org/e4q3m11g3/Scrshot5.png

    or
    https://www.dropbox.com/sh/i2kze8hgbyp0s6t/RphTWF19NW
    Errors:

    Code:
    mainwindow.obj:-1: error: LNK2005: main already defined in main.obj
    debug\uwm.exe:-1: error: LNK1169: one or more multiply defined symbols found
    then

    I went to the directory of project and deleted mainwindow.cpp and mainwindow.h
    and now errors are gone
    But after I build it it didn't run the program
    Please help !!!




    http://s22.postimg.org/iqosatggx/Scrshot6.png
    http://s22.postimg.org/d3sfdcdy9/Scrshot7.png
    http://s22.postimg.org/m2ihqdiu9/Scrshot8.png
    http://s22.postimg.org/4iz3m63s1/Scrshot9.png


    and I get this error


    http://s21.postimg.org/6z7t2mnx3/Scrshot11.png




    Code:
    11:58:21: Running steps for project uwm...
    11:58:21: Configuration unchanged, skipping qmake step.
    11:58:21: Starting: "C:\Qt\Qt5.0.2\Tools\QtCreator\bin\jom.exe" 
     C:\Qt\Qt5.0.2\Tools\QtCreator\bin\jom.exe -f Makefile.Debug
    Error: dependent '..\uwm\mainwindow.cpp' does not exist.
    jom: D:\qt\build-uwm-Desktop_Qt_5_0_2_MSVC2012_64bit-Debug\Makefile [debug] Error 2
    11:58:21: The process "C:\Qt\Qt5.0.2\Tools\QtCreator\bin\jom.exe" exited with code 2.
    Error while building/deploying project uwm (kit: Desktop Qt 5.0.2 MSVC2012 64bit)
    When executing step 'Make'
    11:58:21: Elapsed time: 00:00.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    mainwindow isn't mentioned anywhere in any of the files you downloaded.

    I suggest either
    build->clean
    followed by
    build->rebuild all

    Or just create a new EMPTY project and start again with the 4 files you downloaded.

    The rot set in when you left mainwindow.cpp lying around in the same directory
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Feb 2013
    Posts
    17
    Solved thanks !!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. code won't compile even if exactly copied from ebook
    By DaveHubbard in forum C++ Programming
    Replies: 10
    Last Post: 03-26-2013, 12:57 PM
  2. Need help on chess game I copied
    By retroshell in forum C++ Programming
    Replies: 8
    Last Post: 12-25-2011, 10:42 PM
  3. Can a class know it's being copied?
    By 6tr6tr in forum C++ Programming
    Replies: 4
    Last Post: 04-28-2008, 03:07 PM
  4. Lines from Unix's source code have been copied into the heart of Linux????
    By zahid in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 05-19-2003, 03:50 PM
  5. Copied software
    By GSLR in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 05-08-2002, 03:32 PM